#pragma once


#include <IXPainter.h>
#include "XBaseObjImpl.h"


class CXPainterImpl : public CXBaseObjImpl<IXPainter>
{
    typedef CXBaseObjImpl<IXPainter> superclass;

    BEGIN_DEF_SKIN_CLASS(CXPainterImpl, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXPainter,    0)
    END_DEF_SKIN_CLASS();

public:
    CXPainterImpl();

public:
    // IXPainter
    virtual DWORD   STDMETHODCALLTYPE   get_PainterMode();
    virtual HRESULT STDMETHODCALLTYPE   put_PainterMode(IN DWORD dwMode);

    virtual HRESULT STDMETHODCALLTYPE   put_Canvas(IN XCANVAS xCanvas);
    virtual HRESULT STDMETHODCALLTYPE   get_Canvas(OUT XCANVAS* pCanvas);

    virtual HRESULT STDMETHODCALLTYPE   BitDraw(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes);
    virtual HRESULT STDMETHODCALLTYPE   DefinedAlphaDraw(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes);
    virtual HRESULT STDMETHODCALLTYPE   ValuedAlphaDraw(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, IN BYTE byAlphaValue);
    virtual HRESULT STDMETHODCALLTYPE   TransparentDraw(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, IN COLORREF clrTrans);
    virtual HRESULT STDMETHODCALLTYPE   TransparentAlphaDraw(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, IN BYTE byAlphaValue, IN COLORREF clrTrans);

    virtual HRESULT STDMETHODCALLTYPE   BitDrawEx(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, ImageDrawParams* pParam, ImageDrawType type);
    virtual HRESULT STDMETHODCALLTYPE   DefinedAlphaDrawEx(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, ImageDrawParams* pParam, ImageDrawType type);
    virtual HRESULT STDMETHODCALLTYPE   ValuedAlphaDrawEx(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, IN BYTE byAlphaValue, ImageDrawParams* pParam, ImageDrawType type);
    virtual HRESULT STDMETHODCALLTYPE   TransparentDrawEx(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, IN COLORREF clrTrans, ImageDrawParams* pParam, ImageDrawType type);
    virtual HRESULT STDMETHODCALLTYPE   TransparentAlphaDrawEx(IN XIMAGE xImage, IN RECT* lpSrc, IN RECT* lpDes, IN BYTE byAlphaValue, IN COLORREF clrTrans, ImageDrawParams* pParam, ImageDrawType type);

    virtual HRESULT STDMETHODCALLTYPE   DrawIcon(XICON xIcon, RECT* lpDes);

    virtual void    STDMETHODCALLTYPE   DrawLine(POINT& PtSrc, POINT& PtDes, COLORREF clrLine);
    virtual void    STDMETHODCALLTYPE   FillRect(RECT* prc, COLORREF clr);
    virtual void    STDMETHODCALLTYPE   Rectangle(RECT* lpRect, COLORREF clrRect);
    virtual void    STDMETHODCALLTYPE   Rectangle(RECT* lpRect, COLORREF clrRect, COLORREF clrFill);
    virtual void    STDMETHODCALLTYPE   Rectangle(RECT* lpRect, COLORREF clrRect, int nBorder);
    virtual void    STDMETHODCALLTYPE   Rectangle(RECT* lpRect, COLORREF clrRect, COLORREF clrFill, int nBorder);
    virtual void    STDMETHODCALLTYPE   DrawGradient(RECT& rcRect, COLORREF rgbTop, COLORREF rgbBottom, BOOL bVert);

    virtual void    STDMETHODCALLTYPE   DrawFocusRect(RECT* lpRect);

    virtual void    STDMETHODCALLTYPE   RoundRectangle(RECT* lpRect, COLORREF clrRect, int nWidth, int nHeight);
    virtual void    STDMETHODCALLTYPE   RoundRectangle(RECT* lpRect, COLORREF clrRect, COLORREF clrFill, int nWidth, int nHeight);

    virtual BOOL    STDMETHODCALLTYPE   XDrawText(LPCTSTR szText, size_t nLength, LPRECT prcText, IXTextEnv* pTextEnv, IXFont* pFont);
    virtual BOOL    STDMETHODCALLTYPE   XGetTextSize(LPCTSTR szText, size_t nLength, LPSIZE pTextSize, IXFont* pFont, IXTextEnv* pTextEnv);

    virtual void    STDMETHODCALLTYPE   GetTriangleSize(OUT LPSIZE pSize);
    virtual void    STDMETHODCALLTYPE   DrawTriangle(int x, int y, BOOL bUp);

protected:
    XCANVAS     m_xCanvas;
    DWORD       m_dwPainterMode;
};
